//
//  LDMyResumeBaseBottomBtnV.swift
//  DingDongZP
//
//  Created by LeMac on 16/12/28.
//  Copyright © 2016年 51ledian.com. All rights reserved.
//

import UIKit

class LDMyResumeBaseBottomBtnV: UIView {

    
    

    
    var tapBtnLeft:(()->())?
    var tapBtnRight:(()->())?
    
    var divideLine:UIView?
    
    private var btnL:UIButton?
    private var btnR:UIButton?
   
    override init(frame:CGRect) {
        
        super.init(frame: frame)
        setupView()
    }

    var titleArr = ["",""] {
        
        didSet{
            
            btnL?.setTitle(titleArr[0], forState: .Normal)
            btnR?.setTitle(titleArr[1], forState: .Normal)
        }
    }
    var imgNameArr = ["",""] {
        
        didSet{
            
            btnL?.setImage(UIImage.init(named: imgNameArr[0]), forState: .Normal)
            btnR?.setImage(UIImage.init(named: imgNameArr[1]), forState: .Normal)
        }
    }
    func setupView() {
        
        btnL = UIButton.setDetailsBtn("管理期望工作", picName: "commom_btn_manger", btnBackColor: LDFontColor.White, titleColor: LDGolbalColor.Green)!
        btnL!.titleLabel?.font = LDFont.Font16
        btnL!.layer.cornerRadius = 0
        btnL!.bk_whenTapped { [weak self] in
            
            if self?.tapBtnLeft != nil {
            
                self?.tapBtnLeft!()
            }
            
        }
        
        btnR = UIButton.setDetailsBtn("编辑微简历", picName: "common_me_edit_profile", btnBackColor: LDFontColor.White, titleColor: LDGolbalColor.Green)!
        btnR!.titleLabel?.font = LDFont.Font16
        btnR!.layer.cornerRadius = 0
        btnR!.bk_whenTapped { [weak self] in
            
            if self?.tapBtnRight != nil {
                
                self?.tapBtnRight!()
            }
        }
        
        divideLine = {
            let lineV = UIView()
            lineV.backgroundColor = LDLineColorLightGray
            return lineV
        }()
        
        addSubview(btnL!)
        addSubview(btnR!)
        addSubview(divideLine!)
        
        
        divideLine?.snp_makeConstraints(closure: { (make) in
            
            make.center.equalTo(self)
            make.width.equalTo(1)
            make.top.equalTo(LDMargin_V*1.5)
            make.bottom.equalTo(-LDMargin_V*1.5)
        })
        
        
        let lineH = UIView()
        lineH.backgroundColor = LDLineColorLightGray
        addSubview(lineH)
        
        lineH.snp_makeConstraints { (make) in
            
            make.top.left.right.equalTo(0)
            make.height.equalTo(0.5)
        }
        
        
        btnL!.snp_makeConstraints { (make) in
            
            make.left.top.bottom.equalTo(0)
            make.right.equalTo(divideLine!)
        }
        btnR!.snp_makeConstraints { (make) in
            
            make.right.top.bottom.equalTo(0)
            make.left.equalTo(divideLine!)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
